/*************************************************************************
	> File Name: B3928.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-06-24 11:42:50
 ************************************************************************/

#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

#define MAX_N 50000
int a[MAX_N + 5], b[MAX_N + 5];

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
    }
    sort(a, a + n);
    sort(b, b + n);
    int i = 0, j = 0, ans = 0;
    while (i < n && j < n) {
        if (a[i] > b[j]) {
            ans++;
            i++, j++;
        } else {
            i++;
        }
    }
    cout << ans << endl;
    return 0;
}
